package com.ruoyi.consumer.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.consumer.mapper.CAgentRelationsMapper;
import com.ruoyi.consumer.domain.CAgentRelations;
import com.ruoyi.consumer.service.ICAgentRelationsService;

/**
 * 代理关系Service业务层处理
 * 
 * @author YFENTEST
 * @date 2023-11-19
 */
@Service
public class CAgentRelationsServiceImpl implements ICAgentRelationsService 
{
    @Autowired
    private CAgentRelationsMapper cAgentRelationsMapper;

    /**
     * 查询代理关系
     * 
     * @param agentId 代理关系主键
     * @return 代理关系
     */
    @Override
    public CAgentRelations selectCAgentRelationsByAgentId(Integer agentId)
    {
        return cAgentRelationsMapper.selectCAgentRelationsByAgentId(agentId);
    }

    /**
     * 查询代理关系列表
     * 
     * @param cAgentRelations 代理关系
     * @return 代理关系
     */
    @Override
    public List<CAgentRelations> selectCAgentRelationsList(CAgentRelations cAgentRelations)
    {
        return cAgentRelationsMapper.selectCAgentRelationsList(cAgentRelations);
    }

    /**
     * 新增代理关系
     * 
     * @param cAgentRelations 代理关系
     * @return 结果
     */
    @Override
    public int insertCAgentRelations(CAgentRelations cAgentRelations)
    {
        cAgentRelations.setCreateTime(DateUtils.getNowDate());
        return cAgentRelationsMapper.insertCAgentRelations(cAgentRelations);
    }

    /**
     * 修改代理关系
     * 
     * @param cAgentRelations 代理关系
     * @return 结果
     */
    @Override
    public int updateCAgentRelations(CAgentRelations cAgentRelations)
    {
        cAgentRelations.setUpdateTime(DateUtils.getNowDate());
        return cAgentRelationsMapper.updateCAgentRelations(cAgentRelations);
    }

    /**
     * 批量删除代理关系
     * 
     * @param agentIds 需要删除的代理关系主键
     * @return 结果
     */
    @Override
    public int deleteCAgentRelationsByAgentIds(Integer[] agentIds)
    {
        return cAgentRelationsMapper.deleteCAgentRelationsByAgentIds(agentIds);
    }

    /**
     * 删除代理关系信息
     * 
     * @param agentId 代理关系主键
     * @return 结果
     */
    @Override
    public int deleteCAgentRelationsByAgentId(Integer agentId)
    {
        return cAgentRelationsMapper.deleteCAgentRelationsByAgentId(agentId);
    }
}
